ROOTCXXFLAGS      := $(shell root-config --cflags)
CXXFLAGS  = -fPIC -ggdb3 -Wall -m32
ROOTLDFLAGS      := $(shell root-config --libs)
ROOTLDFLAGS      += $(shell root-config --ldflags)
#ROOTLDFLAGS      += $(shell root-config --cxxflags)
#ROOTLDFLAGS      += $(shell root-config --cppflags)

ROOTLDGFLAGS     := $(shell root-config --glibs)

CXXFLAGS += $(ROOTCXXFLAGS) 
LDFLAGS += $(ROOTLDGFLAGS) $(MACLDFLAGS)

LIBS = -lm -lstdc++ -lfftw3 

# MAC
 ## L_REC += -L$(KGROOT)/EventBrowser/lib #-lSdArray   (nur  auskommentiert)
# LDFLAGS       = -ggdb3 -dynamic -bind_at_load


# directory names
SRC_DIR = .
BIN_DIR = .


EXE=$(patsubst $(SRC_DIR)/%.cc, $(BIN_DIR)/%, $(wildcard $(SRC_DIR)/*.cc))

all: $(EXE)

$(BIN_DIR)/%: $(SRC_DIR)/%.cc
	$(CXX) $(CXXFLAGS) $^ -o $@ $(LDFLAGS) $(LIBS) -O3 -Wall -lm

clean:
	rm -f *.o *~ main
